var UserCreateController = FormController.extend({
	_userModel : null,
	_location : null,
	_route : null,

	init : function($scope, userModel, $location, $route) {
		this._userModel = userModel;
		this._location = $location;
		this._route = $route;
		this._super($scope)
	},

	defineScope : function() {
		this.$scope.user = {
			enablement : true,
			role : "basic"
		};

		this.$scope.save = this.save.bind(this);
	},

	save : function(user) {
		var convertdUser = {
			'username' : user.username,
			'password' : user.password,
			'fullname' : user.fullname,
			'email' : user.email,
			'roles' : [ user.role ],
			'enablement' : user.enablement
		}

		this._userModel.save(convertdUser, function(data, status, headers,
				config) {
			this._location.path('/system/user-management');
		}.bind(this));
	}
})

UserCreateController.$inject = [ '$scope', 'UserModel', '$location', '$route' ];